/**
 * Created by xie on 2018/3/13.
 */
angular.module('module.collect')
    .controller('CollectController', CollectController);

CollectController.$inject = ['$scope','$state','$cookies','$rootScope','MainpageService'];

function CollectController($scope, $state,$cookies, $rootScope,MainpageService) {
    if(!$cookies.get("userInfo")){
        $state.go("login");
    }
    var vm = this;
    vm.user = JSON.parse($cookies.get("userInfo"));

        MainpageService.getArticleByType(vm.user.usercollect).$promise.then(function(data){
            vm.collects = data;

    },function(err){
        console.log(err)
    });
    vm.goDetails = goDetails;
    function goDetails(article){
        $state.go("atricle",{articleid:article.articleid});
    }



}